package com.jlpay.openapi.demo.cashier;

import com.jlpay.open.jlpay.sdk.java.model.cashier.request.TradeCancelRequest;
import com.jlpay.open.jlpay.sdk.java.model.cashier.response.TradeCancelResponse;
import com.jlpay.open.jlpay.sdk.java.utils.json.JsonUtils;
import com.jlpay.openapi.demo.JlpayOpenApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author dengwenning
 * @since 2024/9/24
 **/
public class TradeCancelService {
    private static final Logger LOGGER = LoggerFactory.getLogger(TradeCancelService.class);

    public static void main(String[] args) {
        TradeCancelRequest tradeCancelRequest = buildTradeCancelRequest();
        TradeCancelResponse tradeCancelResponse = JlpayOpenApiService.openMerchService()
                .post(tradeCancelRequest, TradeCancelResponse.class);
        LOGGER.info("收银托管订单关闭响应:{}", JsonUtils.toString(tradeCancelResponse));
    }

    private static TradeCancelRequest buildTradeCancelRequest() {
        TradeCancelRequest tradeCancelRequest = new TradeCancelRequest();

        tradeCancelRequest.setMerchNo("849584358120018");
        tradeCancelRequest.setOutTradeNo("ld201911023465530");
        tradeCancelRequest.setOriOutTradeNo("ld201911023465529");
        tradeCancelRequest.setRemark("备注信息");

        return tradeCancelRequest;
    }
}
